package org.example.seckill.controller;


import org.example.core.utils.R;
import org.example.seckill.entity.RegularSeckill;
import org.example.seckill.service.SeckillScheduledService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/seckill/front")
public class SeckillFrontController {

    @Autowired
    private SeckillScheduledService seckillScheduledService;

    @GetMapping("/goods/{promotionId}")
    public R<?> getNowSeckillSku(@PathVariable("promotionId") Long promotionId){
        List<RegularSeckill> regularSeckills = seckillScheduledService.getNowSeckillSku(promotionId);
        return R.ok(regularSeckills);
    }

}
